<template>
  <content-wrap>
    <div class="flex justify-between">
      <el-form
        :model="queryParams"
        ref="queryFormRef"
        :inline="true"
        label-width="90px"
        label-position="left"
      >
        <el-form-item label="企业名称:" prop="corpName">
          <el-input
            v-model="queryParams.corpName"
            placeholder="请输入企业名称"
            clearable
            class="!w-200px"
          />
        </el-form-item>
        <el-form-item label="联系人:" prop="contactName">
          <el-input
            v-model="queryParams.contactName"
            placeholder="请输入企业名称"
            clearable
            class="!w-200px"
          />
        </el-form-item>
        <el-form-item label="联系人电话:" prop="contactMobile">
          <el-input
            v-model="queryParams.contactMobile"
            placeholder="请输入联系人电话"
            clearable
            class="!w-200px"
          />
        </el-form-item>
        <el-form-item label="外呼类型:" prop="callChannel">
          <el-select clearable v-model="queryParams.callChannel" placeholder="请选择外呼类型">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" plain @click="handleQuery"
            ><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button
          >
          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table :data="list" style="width: 100%">
      <el-table-column prop="corpName" label="企业名称"> </el-table-column>
      <el-table-column prop="contactName" label="联系人"> </el-table-column>
      <el-table-column prop="contactMobile" label="联系人电话"> </el-table-column>
      <el-table-column prop="adminUser" label="登录名"> </el-table-column>
      <el-table-column prop="adminUserPass" label="登录密码"> </el-table-column>
      <el-table-column prop="callCostPrice" label="话费单价"> </el-table-column>
      <el-table-column prop="callChannel" label="外呼类型">
        <template #default="scope">
          <el-tag type="primary" plan> {{ typeMap[scope.row.callChannel] }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="accountNum" label="需开通账户数"> </el-table-column>
      <el-table-column prop="agentNum" label="需开通坐席数"> </el-table-column>
      <el-table-column prop="handleStatus" label="处理进度">
        <template #default="scope">
          <el-tag :type="progressMap[scope.row.handleStatus].type" plan>
            {{ progressMap[scope.row.handleStatus].label }}</el-tag
          >
        </template>
      </el-table-column>
    </el-table>
    <Pagination
      v-model:limit="queryParams.pageSize"
      v-model:page="queryParams.pageNo"
      :total="total"
      @pagination="getList"
    />
  </content-wrap>
</template>

<script setup>
import * as proxyApi from '@/api/home/proxy.ts'
import Apeningapplication from './Apeningapplication.vue'
const list = ref([])
const total = ref(0)
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  corpName: '',
  contactName: '',
  contactMobile: '',
  callChannel: ''
})
const typeMap = {
  1: '点呼',
  2: '群呼',
  3: '全部'
}
const progressMap = {
  0: {
    label: '待创建',
    type: 'primary'
  },
  1: {
    label: '已创建',
    type: 'success'
  },
  9: {
    label: '拒绝',
    type: 'error'
  }
}
const options = [
  {
    label: '点呼',
    value: 1
  },
  {
    label: '群呼',
    value: 2
  },
  {
    label: '全部',
    value: 3
  }
]
/**列表*/
const getList = async () => {
  const data = await proxyApi.approvePage(queryParams)
  list.value = data.list
  total.value = data.total
}
/**搜索*/
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}
/**重置*/
const resetQuery = () => {
  queryParams.pageNo = 1
  queryParams.corpName = ''
  queryParams.contactName = ''
  queryParams.contactMobile = ''
  queryParams.callChannel = ''
  getList()
}
onMounted(() => {
  getList()
})

defineExpose({ getList })
/**删除*/
const del = () => {}
</script>

<style lang="scss" scoped></style>
